﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame1
{
    class PedroSouza : Scene
    {
        AnimatedObject2D Nave;
        ReachPoint reachpoint;
        /*Rectangle naveR;
        Rectangle reachPointR;
        */
       // Texture2D naveT, reachpointT;
        //Rectangle naveR, reachpointR;


        SpriteFont fonte2;
        bool l;

        public override void Load(ContentManager Content)
            {
                Animation[] animations = new Animation[1];
                animations[0].name = "Standing";
                animations[0].currentFrame = Vector2.Zero;
                animations[0].frameRate = 1000 / 24;
                animations[0].frameSize = new Vector2(39, 43);
                animations[0].totalFrames = new Vector2(0, 3);
                animations[0].startP = new Vector2(39, 0);

                Nave = new Player(Vector2.Zero, Color.White,
                   Content.Load<Texture2D>("ShipSpriteSheet"), animations);


                //naveT = Content.Load <Texture2D> ("nave");
                //naveR = new Rectangle(100, 100, 55, 55);

                //reachpointT = Content.Load<Texture2D>("bloco");
                //reachpointR = new Rectangle(750, 540, 50, 40); 
                

                animations[0].name = "Weak Shot";
                animations[0].currentFrame = Vector2.Zero;
                animations[0].frameRate = 1000 / 24;
                animations[0].frameSize = new Vector2(3, 9);
                animations[0].totalFrames = new Vector2(2, 0);
                animations[0].startP = new Vector2(0, 220);
            
                
            reachpoint=new ReachPoint(new Vector2(750,540),Color.White,Content.Load<Texture2D>("Sem título"));
            
            fonte2 = Content.Load<SpriteFont>("HUD");
            }
       
        public override void Update(GameTime gameTime)
        {
            Nave.Origem = new Vector2(Nave.Retangulo.Width / 2, Nave.Retangulo.Height / 2);
            l = Nave.Collision(reachpoint);

            //if (Keyboard.GetState().IsKeyDown(Keys.Right))
             //   naveR.X += 5;
           // else if (Keyboard.GetState().IsKeyDown(Keys.Left))
             //   naveR.X -= 5;

            //if (Keyboard.GetState().IsKeyDown(Keys.Down))
             //   naveR.Y += 5;
            //else if (Keyboard.GetState().IsKeyDown(Keys.Up))
              //  naveR.Y -= 5;
            
            Nave.Update(gameTime);
        }
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
           Nave.Draw(spriteBatch);
           if (l)
            {
               spriteBatch.DrawString(fonte2, "You Reach the point", new Vector2(200f), Color.White);
            }
           //if (naveR.Intersects(reachpointR))
          

           //spriteBatch.Draw(naveT, naveR, Color.White);
           //spriteBatch.Draw(reachpointT, reachpointR, Color.White);

               reachpoint.Draw(spriteBatch);
            
           
        }

        public bool i { get; set; }
    }
    }